﻿namespace KingerRobot.MexicoSailunMDC.SpiService;

public class LineManageServiceImpl : ILineManagerService
{
    ILineManager _LineMangerDao = new BLineManager();
    public int FlushScadaBoxTasks(ScadaBoxTaskParam param)
    {
        int result = -1;

        if (String.IsNullOrWhiteSpace(param?.LineCode))//线体编号必须有
        {
            return result;
        }

        var query = _LineMangerDao.QueryScadaBoxTasksByLineCode(param.LineCode);

        if (query is null)//没有节点数据，添加
        {
            result = _LineMangerDao.InsertToScadaBoxTasks(param);
        }
        else//已有节点数据，修改
        {
            result = _LineMangerDao.UpdateScadaBoxTasksByLineCode(param);
        }

        return result;
    }
}

